<include file="./Template/Admin/header.html" title="基本设置" />
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>基本设置</h5>
                </div>
                <div class="ibox-title">
                    <div class="col-sm-4"> </div>
                    <button class="btn btn-white buttonSwitch">站点配置</button>
                    <button class="btn btn-primary buttonSwitch">核心配置</button>
                    <button class="btn btn-primary buttonSwitch">邮箱配置</button>
                    <button class="btn btn-primary buttonSwitch">附件配置</button>
                    <button class="btn btn-primary buttonSwitch">会员整合</button>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="Forma" action="{:U('Admin/Config/Save')}">
                        <div class="ibox-content divSwitch" style="display: block;">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">参数说明</label>
                                <div class="col-sm-6">
                                    <label class="col-sm-6 control-label">参数值</label>
                                </div>
                                <div class="col-sm-3">变量名</div>
                            </div>
                            <volist name="configInfo" id="v">
                                <if condition="$v.group_id eq 0">
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">{$v.title}:</label>
                                        <div class="col-sm-6">
                                            <input id="{$v.variable}" name="{$v.variable}" class="form-control" value="{$v.value}" type="text">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                        <div class="col-sm-3">{$v.variable}</div>
                                    </div>
                                </if>
                            </volist>
                        </div>
                        <div class="ibox-content divSwitch" style="display: none;">
                            <volist name="configInfo" id="v">
                                <if condition="$v.group_id eq 1">
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">{$v.title}:</label>
                                        <div class="col-sm-6">
                                            <input id="{$v.variable}" name="{$v.variable}" class="form-control" value="{$v.value}" type="text">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                        <div class="col-sm-3">{$v.variable}</div>
                                    </div>
                                </if>
                            </volist>
                        </div>
                        <div class="ibox-content divSwitch" style="display: none;">
                            <volist name="configInfo" id="v">
                                <if condition="$v.group_id eq 2">
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">{$v.title}:</label>
                                        <div class="col-sm-6">
                                            <input id="{$v.variable}" name="{$v.variable}" class="form-control" value="{$v.value}" type="text">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                        <div class="col-sm-3">{$v.variable}</div>
                                    </div>
                                </if>
                            </volist>
                        </div>
                        <div class="ibox-content divSwitch" style="display: none;">
                            <volist name="configInfo" id="v">
                                <if condition="$v.group_id eq 3">
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">{$v.title}:</label>
                                        <div class="col-sm-6">
                                            <input id="{$v.variable}" name="{$v.variable}" class="form-control" value="{$v.value}" type="text">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                        <div class="col-sm-3">{$v.variable}</div>
                                    </div>
                                </if>
                            </volist>
                        </div>
                        <div class="ibox-content divSwitch" style="display: none;">
                            <volist name="configInfo" id="v">
                                <if condition="$v.group_id eq 4">
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">{$v.title}:</label>
                                        <div class="col-sm-6">
                                            <input id="{$v.variable}" name="{$v.variable}" class="form-control" value="{$v.value}" type="text">
                                            <span class="help-block m-b-none"></span>
                                        </div>
                                        <div class="col-sm-3">{$v.variable}</div>
                                    </div>
                                </if>
                            </volist>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit" id="submit">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__ADMIN__js/jquery.min.js"></script>
<script src="__ADMIN__js/bootstrap.min.js"></script>
<script src="__ADMIN__js/plugins/layer.3/layer.js"></script>
<script src="__ADMIN__js/common.js"></script>
<script src="__ADMIN__js/content.min.js"></script>
<script src="__ADMIN__js/plugins/validate/jquery.validate.min.js"></script>
<script src="__ADMIN__js/plugins/validate/messages_zh.min.js"></script>
<script src="__ADMIN__js/plugins/switchery/switchery.js"></script>
<script>
    $(function(){
        //初始化Checkbox按钮样式
        var elem = document.querySelector('.js-switch');
        var init = new Switchery(elem);



        $('.buttonSwitch').click(function(){
            $(this).removeClass('btn-primary').addClass('btn-white').siblings('.buttonSwitch').removeClass('btn-white').addClass('btn-primary');
            var num = $(this).index();
            $('.divSwitch').eq(num-1).css('display', 'block').siblings('.divSwitch').css('display', 'none');
        });


        $('#submit').click(function(){
            var data = new  FormData(document.getElementById('Forma'));
            $.ajax({
                url:$('#Forma').attr('action'),
                type:"POST",
                data:data,
                cache: false,
                processData:false,
                contentType:false,
                success:function(data){
                    if(data.status > 0){
                        common.error(data.msg);
                    }else{
                        common.success(data.msg,"{:U('Admin/Config/index')}");
                    }
                },
                dataType:'JSON'
            });
            return false;
        });
    });
</script>
</body>
</html>
